<template>
  <view class="card" @click="goPage()">
    <view class="flex">
      <view class="name font-size-16"> {{ info.name }} </view>
      <view class="price font-size-16"> 金额：￥{{ info.price }} </view>
    </view>
    <view class="flex" v-for="item in info.drug" :key="item.goodsId">
      <view class="drug"> {{ item.drugName }}_{{ item.spec }} </view>
      <view class="number"> {{ '*' + item.number }}</view>
    </view>
    <view class="flex">
      <view class="time"> {{timeType}}  {{ info.time }} </view>

      <view class="state" v-if="info.state">
        <u-tag :text="info.state" :type="info.stateType ? info.stateType : 'primary'" />
      </view>
    </view>
    <view class="address"> 收货地址： {{ info.address }} </view>

    <slot></slot>
  </view>
</template>

<script>
export default {
  props: {
    timeType:{
      type:String,
      default:'派单时间：'
    },
    info: {
      // 短信内容的对象
      type: Object,
      default: {
        name: '周杰伦',
        price: '498',
        drug: [
          {
            drugName: '999感冒灵',
            spec: '15mg*5片',
            number: '一盒'
          }
        ],
        remake: '',
        takeOrderGoodsList: [],
        time: '2022/12/23 12:23:31',
        address: '湖南达嘉维康医药产业股份有限公司五一路店',
        state: '',
        stateType: 'primary',
        url: '/pages/receive/detail?orderId=31321321'
      }
    }
  },
  methods: {
    goPage() {
      if (this.info.url) {
        wx.navigateTo({
          url: this.info.url
        })
      }
    }
  }
}
</script>

<style lang="scss" scope>
.card {
  margin-bottom: 20upx;
  padding: 20upx;
  background: #fff;
}
.flex {
  display: flex;
  justify-content: space-between;
  align-content: center;
  margin: 20upx 0;
}
.flex:first-child {
  margin-top: 0;
}
.price {
  color: #e6b266;
}
.drug {
  color: #5da8e7;
}
.font-size-16 {
  font-size: 32upx;
}

.time,
.address,
.number {
  color: #989898;
}
</style>
